<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<button id="b1">按钮</button>
<input id="t1">
<hr>

<h1 id="h1"></h1>




</body>
</html>
<!-- jQuery -->
<script src="js/jquery-3.7.0.js"></script>

<script>


    
    $("#b1").click(function () {
        $.ajax({
            url: "/admin/newsType/del.action",
            dataType: "json",
            type: "get",
            data: {
                id: $("#t1").val()
            },
            beforeSend: function (XMLHttpRequest) {
                console.log("准备开始请求后端..............");

            },
            success: function (data, textStatus, jqXHR) {
                console.log("响应成功.............."+textStatus);
                $("#h1").text(data.mess);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $("#h1").text("删除参数必须是整数")
                console.log(XMLHttpRequest.status);
                console.log("响应失败.............." + XMLHttpRequest);
                console.log("响应失败.............." + textStatus);
            },
            complete: function (XMLHttpRequest, textStatus) {
                console.log("响应结束.............."+textStatus);

            }
        });

    });
    
    


</script>